using System.ComponentModel;
using System.Globalization;
using SportTracksPluginFramework;
using ZoneFiveSoftware.Common.Visuals;

namespace FilteredStatistics.View
{
    class FilteredStatisticsSettingsPage : STFrameworkSettingsPage
    {
        public FilteredStatisticsSettingsPage()
        {
        }

#region STFrameworkSettingsPage Members

        public override System.Guid Id
        {
            get { return GUIDs.SettingsPage; }
        }

        public override System.Collections.Generic.IList<ISettingsPage> SubPages
        {
            get { return null; }
        }

        public override bool HidePage()
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs("Visible"));
            }

            return true;
        }

        public override string PageName
        {
            get { return PluginView.GetLocalizedString("ActivityPageTitleSettingsText"); }
        }

        public override void ShowPage(string bookmark)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs("Visible"));
            }

            CreatePageControl().Refresh();
        }

        public override IPageStatus Status
        {
            get { return null; }
        }

        public override void ThemeChanged(ITheme visualTheme)
        {
            if (m_Control != null)
            {
                ((FilteredStatisticsSettingsControl)CreatePageControl()).ThemeChanged(visualTheme);
            }
        }

        public override string Title
        {
            get { return PluginView.GetLocalizedString("ActivityPageTitleSettingsText"); }
        }

        public override void UICultureChanged(CultureInfo culture)
        {
            if (m_Control != null)
            {
                m_Control.UICultureChanged(culture);
            }
        }

        public override System.Windows.Forms.Control SettingsPageControl
        {
            get
            {
                if (m_Control == null)
                {
                    m_Control = new FilteredStatisticsSettingsControl();
                }

                return m_Control;
            }
        }

        public override System.Guid MainPluginId
        {
            get { return GUIDs.PluginMain; }
        }

        public override event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

#endregion

        private FilteredStatisticsSettingsControl m_Control;
    }
}
